import becker.robots.City;
import becker.robots.Direction;
import becker.robots.Robot;

/* Programmers: Abubakr
 * Date Created: Feb.27, 2012
 * Date Modified: Feb.27, 2012
 * Class Name: TripleJumper
 * Class Description: This class extends the Robot class in order to create a new robot able
 * 					  to jump over gaps. It includes new methods such as jump() and longJump().
 */
public class TripleJumper extends Robot {

	//Creates a TripleJumper given a city, street, avenue and direction.
	public TripleJumper(City aCity, int aStreet, int anAvenue, Direction aDirection) {
		super(aCity, aStreet, anAvenue, aDirection);
	}

	//Turns the TripleJumper left the specified number of times.
	public void turnLeft(int i) {
		for (int x = 0; x < i; x++){
			super.turnLeft();
		}
	}

	//The TripleJumper turns right.
	public void turnRight() {
		turnLeft(3);
	}

	//The TripleJumper moves the specified number of times.
	public void move(int i) {
		for (int x = 0; x < i; x++){
			super.move();
		}
	}	

	//The TripleJumper backs up two intersections.
	public void backUp() {
		this.turnLeft(2);
		this.move(2);
		this.turnLeft(2);
	}

	//The TripleJumper 'jumps' over an intersection.
	public void jump() {
		super.turnLeft();
		super.move();
		this.turnRight();
		this.move(2);
		this.turnRight();
		this.move();
		super.turnLeft();
	}

	//The TripleJumper 'jumps' over three intersections.
	public void longJump() {
		this.backUp();
		this.move(2);
		super.turnLeft();
		super.move();
		this.turnRight();
		this.move(4);
		this.turnRight();
		this.move();
		super.turnLeft();
	}

}
